package main

import (
	"fmt"
	"os"
)

func main() {

	tree1("D:\\Environment\\GoWorks\\src\\Go_Study_Project")
}

func tree(dir string, i int) {
	//func ReadDir(name string) ([]DirEntry, error) {

	fileinfo, err := os.ReadDir(dir)

	if err != nil {
		fmt.Println(err)
	}
	for _, entry := range fileinfo {
		for j := 0; j < i; j++ {
			fmt.Print("----")
		}
		fmt.Println(entry.Name())
		if entry.IsDir() {
			tree(dir+"\\"+entry.Name(), i+1)
		}

	}
}

func tree1(dir string) {
	tree(dir, 0)
}
